import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerFamilyFundApi {
  /** 基金情况信息 */
  export interface FamilyFund {
    id: number; // 主键ID
    employeeId: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应 system_person.id
    familyName: string; // 家庭成员姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 家庭成员身份证号
    fundNameOrCode: string; // 基金名称或代码
    fundShares: string; // 基金份额
    netValue: number; // 填报前一交易日净值
    recordDate: string; // 记录时间
    status: number; // 是否有效（1：有效，0：无效）
  }
}

/** 查询基金情况分页 */
export function getFamilyFundPage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerFamilyFundApi.FamilyFund>>('/per/family-fund/page', data,{ desensitize,encrypt });
}

/** 查询基金情况详情 */
export function getFamilyFund(id: number) {
  return requestClient.get<PerFamilyFundApi.FamilyFund>(`/per/family-fund/get?id=${id}`);
}

/** 新增基金情况 */
export function createFamilyFund(data: PerFamilyFundApi.FamilyFund) {
  return requestClient.post('/per/family-fund/create', data);
}

/** 修改基金情况 */
export function updateFamilyFund(data: PerFamilyFundApi.FamilyFund) {
  return requestClient.put('/per/family-fund/update', data);
}

/** 删除基金情况 */
export function deleteFamilyFund(id: number) {
  return requestClient.delete(`/per/family-fund/delete?id=${id}`);
}

/** 批量删除基金情况 */
export function deleteFamilyFundList(ids: number[]) {
  return requestClient.delete(`/per/family-fund/delete-list?ids=${ids.join(',')}`)
}

/** 导出基金情况 */
export function exportFamilyFund(params: any) {
  return requestClient.download('/per/family-fund/export-excel', { params });
}
